﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZDSoft.TES.Service.SystemService;
using ZDSoft.TES.Core;
using ZDSoft.TES.Entity.SystemEntity;
using ZDSoft.TES.Web.Helpers;

namespace ZDSoft.TES.Web.Controllers
{
    public class AccountController : Controller
    {
        public ActionResult Login()
        {
            return View();
        }

        public string AJAXLogin(string account, string password, string checkCode)
        {
            User user = Container.Instance.Resolve<IUserService>().Login(account, password);
            if (user != null)
            {
                if (checkCode == Session["CheckCode"].ToString())
                {
                    AppHelper.LoginedUser = user;
                    return "success";
                }
                else
                {
                    return "验证码错误！";
                }
            }
            else
            {
                return "用户名或密码无效或该用户名暂未激活！";
            }
        }
    }
}
